home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / PowerPlant / UGetMultipleFiles 1.4 / Read Me next >
Encoding:
Text File  |  1997-07-24  |  5.8 KB  |  166 lines  |  [TEXT/CWIE]

  1. // --------------------------------------------------------------------------------------------
  2. //    UGetMulltipleFiles 1.3.4 - An Add Files utility class
  3. //        created: By David Hirsch, August 14, 1996
  4. //        updated: By David Hirsch, July 4, 1997
  5. // --------------------------------------------------------------------------------------------
  6.  
  7. /*
  8.     This set of files implements an Add Files dialog box (like in CodeWarrior; as a matter of
  9. fact, I took the DLOG, DITL, and dctb from the Code Warrior IDE 1.6 application).  It produces
  10. an LArray of FSSpec records.  I stole bits and pieces of the code from a few sources, noted in
  11. the code.
  12.  
  13. Method:
  14.     I keep the real list of added files in an LArray of FSSpec records, and just show the name
  15. field in the displayed list.  The algorithm should keep both the LArray and the list in the same
  16. order.  I think this is much better than the method used in the Macintosh sample code, which has
  17. a three-column list, but only displays the first column, hiding the parID, and vRefNum columns.
  18.  
  19. Restrictions:
  20.     This is freeware. I retain copyright and must be notified if the source is sold for profit.
  21. If you use it in your code, credit would be appreciated.
  22.  
  23. Requirements:
  24.     This class uses LArray, LString, and UDrawingState, although it could be easily narrowed to
  25. just LArray.
  26.     
  27. Disclaimer:
  28.     I make no claims as to whether this works or is safe or nothin!  It hasn't been robustly
  29. tested.  (Bug reports are appreciated at dhirsch@mail.utexas.edu).
  30.  
  31. Files you need to use:
  32.     UGetMultipleFiles.rsrc - has the DLOG, DITL, and dctb resources
  33.     UGetMultipleFiles.cp - the guts of the class
  34.     UGetMultipleFiles.h
  35.     LFSSpecArrayComp.cp - the FSSpec comparator for the LArray
  36.     LFSSpecArrayComp.h
  37.     GetDirItems.c - a tiny bit of MoreFiles, returns an array of FSSpecs for a directory
  38.     GetDirItems.h
  39.  
  40. Demonstration files you can toss out:
  41.     Read Me (this file)
  42.     Exhibit FAT - the demonstration application
  43.     Exhibit 68K.µ - demo project (68K)
  44.     Exhibit FAT.µ - demo project (FAT)
  45.     Exhibit.cp - demo application class
  46.     Exhibit.h
  47.     Exhibit.rsrc - (taken from Starter Source)
  48.  
  49. Known Bugs:
  50.     - Leaks small (size about 8) handle each time through.  Looks like it's coming from either CW,
  51.       PP, or the Toolbox.  I've posted it to the newsgroups as of today (3/6/97)
  52.       - (Follow-up) Got confirmation that it's the Toolbox that leaks.  Sheesh!
  53.     
  54. Future Improvements:
  55.     - Show Icons in lists
  56.     - Drag and Drop from one list to other (yeah, like I'm gonna code *that* real soon!)
  57.     - Key equivalent for removing files
  58.     
  59. Special Thanks:
  60.     Thanks to Norman Franke for figuring out a bug that had me stumped for over a week!
  61.     Thanks to Thomas Engelmeier and Scott Lasley for code contributions that fixed
  62.         compatibility problems.
  63.     Thanks to Paul Baxter (c/o www.experts-exchange.com) for a LNew patch to get the 
  64.         Toolbox-made list's ListHandle
  65.     
  66. Version History:
  67.     2.0.0    - 7/24/97:
  68.             Added lots of cool features, after getting a patch that gives me the ListHandle for
  69.                 the list the toolbox makes - endless thanks to Paul Baxter!
  70.             Implemented adding folders/volumes (and got paid for it, too!)
  71.             Can now navigate in both lists using keyboard
  72.     1.3.4 - 7/4/97: (not released)
  73.             Removed number of files limit (was 100).  Thanks to Stephen Jensen for pointing out
  74.                 the bug, and giving me his fix.
  75.             The sample program is now in CWPro 1.
  76.     1.3.3 - 3/30/97:
  77.             Added code to supress all checking including translation, locked file alerts, etc.
  78.             This replaces the MAE code from Thomas Engelmeier.
  79.             
  80.     1.3.2 - 3/16/97: (not released)
  81.             Added code to work around MacEasyOpen compatibility problem (Code contributed
  82.                 by Thomas Engelmeier - Many thanks!)
  83.             Added code to work around NOW SuperBoomerang DirectOpen compatibility problem (Code
  84.                 contributed by Scott Lasley - Also, Many Thanks!)
  85.             Changed names of *static* data members from m* to s*
  86.  
  87.     1.3.1 - 3/10/97:
  88.             Fixed bug where removed files didn't reappear in the top list
  89.             Fixed bug where selection didn't disappear when deactivating bottom list
  90.  
  91.     1.3 - 3/6/97:
  92.             Fixed crashing bug when subordinate dialogs are produced
  93.             Fixed problem in LFSSpecArrayComp
  94.             Added double-clicking to remove items
  95.             Added exclusion list support
  96.             Added filtering of added files from main list
  97.             Thanks to Jeff Schmidt for bug reports
  98.  
  99.     1.2 - 9/18/96:
  100.             Fixed Add All 68K crash bug (thanks to Norman Franke)
  101.             Added highlighting for list boxes
  102.             Fixed button enabling/disabling
  103.             
  104.     1.1 - 9/1/96 - Interim version (not released).
  105.             Found work-around for Add All crash bug on 68K.
  106.  
  107.     1.0 - 8/14/96 - Initial release (unnumbered)
  108.  
  109. */
  110.  
  111. - Dave Hirsch, dhirsch@mail.utexas.edu
  112.  
  113. /* Thanks to Thomas Engelmeier who sent me the following;
  114.     He thought it might be useful with this class:
  115.  
  116. - I guess, the SendAEOpenMultipleDocs() routine might be useful for all
  117. users of your Fileselector:
  118.  
  119. void
  120. SendAEOpenMultipleDocs(
  121.     LArray  *inArray )
  122. {
  123.     FSSpec theFSS;
  124.     OSErr       err;
  125.     AEDescList      aliasList;
  126.     AEDesc      aliasDesc;
  127.     AliasHandle     aliasH;
  128.  
  129.     // Create the descList to hold the list of files
  130.  
  131.  
  132.     Try_ {
  133.         AppleEvent      openEvent;
  134.         UAppleEventsMgr::MakeAppleEvent(kCoreEventClass, kAEOpen, openEvent);
  135.         err = AECreateList(NULL, 0, false, &aliasList);
  136.  
  137.         for (short i = 1; i <= inArray->GetCount(); i++)
  138.         {
  139.             inArray->FetchItemAt(i, &theFSS);
  140.  
  141.             aliasDesc.descriptorType = typeAlias;
  142.  
  143.                 //    Now we add the file to descList by creating an alias and then
  144.                 // adding it into the descList using AEPutDesc
  145.  
  146.             err = NewAlias(NULL, &theFSS, &aliasH);
  147.             aliasDesc.dataHandle = (Handle)aliasH;
  148.             err = ::AEPutDesc(&aliasList, 0, &aliasDesc);
  149.             DisposeHandle((Handle)aliasH);
  150.         }
  151.         err = ::AEPutParamDesc(&openEvent, keyDirectObject, &aliasList);
  152.         ThrowIfOSErr_(err);
  153.  
  154.         UAppleEventsMgr::SendAppleEvent(openEvent);
  155.     }
  156.  
  157.     Catch_(inErr) {
  158.         for (short i = 1; i <= inArray->GetCount(); i++)
  159.         {
  160.             inArray->FetchItemAt(i, &theFSS);
  161.             OpenDocument(&theFSS);
  162.         }
  163.     } EndCatch_
  164. }
  165. */
  166.